// t 同步彩票开奖结果 方法
import axios from "axios"

export function sysc_hottery_result(type){
    return new Promise( async (resolve , reject) => {
        if(!type) {
            reject('彩票编码不能为空')
        }
        let lotter_types = {
            dlt: 14,
            ssq: 11,
            fc3d: 12,
            plc: 16,
            pl5: 17
        }
        let caipiaoid = lotter_types[type]
        let key = 'f657d7781b98fa9bbcaaa8ca36be0a11'
        
        let result = await axios.get(`https://api.tanshuapi.com/api/caipiao/v1/query?key=${key}&caipiaoid=${caipiaoid}`)
        resolve(result)
    })
}

// 定时任务更新彩票
export function timing_Lottery_history(){
    return new Promise(async (resolve) => {
        let result = await axios.post(`http://127.0.0.1:3000/api/syncLotteryResult`)
        resolve(result)
    })
}

